import { defineStore } from "pinia";
const useCountStore = defineStore('count', {
    state: () => {
        return {
            sum: 0,
            school: "无名学校"
        }
    },
    // 相当于methods用于写方法
    actions: {
        increment(val:number) {
            this.sum+=val;
        },
        decrement(val:number)
        {
            this.sum-=val;
        }
    },
    // 相当于计算属性
    getters:{
        bigSum:(state)=>{
            return state.sum*10 
        }
    }
})
export default useCountStore